import { ApiCall } from "tsrpc";
import { ReqPlacePiece, ResPlacePiece } from "../../../shared/protocols/worldServer/gomoku/PtlPlacePiece";
import { SubWorldGomoku } from "../../models/SubWorldGomoku";
import { WorldServerConn } from "../../WorldServer";

export async function ApiPlacePiece(call: ApiCall<ReqPlacePiece, ResPlacePiece>) {
    const conn = call.conn as WorldServerConn;

    let current = conn.currentSubWorld as SubWorldGomoku;
    if(!current){
        return call.error('NO_TABLE');
    }

    current.onRPC_PlacePiece(call);
}